package com.byxy.shop.dao;

import java.util.List;

import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.SelectProvider;

import com.byxy.shop.dao.provider.GoodsInfoDaoProvider;
import com.byxy.shop.entity.GoodsInfo;

/**
 * @author 廖善椅
 * @ClassName GoodsInfoDao
 * @Description Dao接口
 * @date 2020年5月17日
 */

public interface GoodsInfoDao {

	@Select("select * from tb_newbee_mall_goods_info where goods_id=#{id}")
	GoodsInfo getById(Integer id);

	@Select("select * from tb_newbee_mall_goods_info")
	List<GoodsInfo> findAllInfos();

	
	@SelectProvider(type = GoodsInfoDaoProvider.class,method = "findByCategroyIdAndKeyword")
	List<GoodsInfo> findByCategoryIdAndkeyword(Integer goodsCategoryId,String keyword);

	@SelectProvider(type = GoodsInfoDaoProvider.class,method = "countByCategroyIdAndKeyword")
	int countByCategoryIdAndkeyword(Integer goodsCategoryId, String keyword);

//	@Select("select * from tb_newbee_mall_goods_info where goods_category_id=#{goodsCategoryId }")
//	List<GoodsInfo> findByCategoryId(Integer goodsCategoryId);
//	
//	@Select("select * from tb_newbee_mall_goods_info where goods_name like concat(#{keyword})")
//	List<GoodsInfo> findBykeyword(@Param("keyword") String keyword);
}
